package springRepo.Library.domain.author;

public class Author {
	
	private String name;
	
	private int birthYear;
	
	private int deathYear;
	
	public Author(){}
	
	public Author(String name, int birthYear, int deathYear){
		this.name = name;
		this.birthYear = birthYear;
		this.deathYear = deathYear;
	}
	
	public String getName(){
		return name;
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public int getBirthYear(){
		return birthYear;
	}
	
	public void setBirthYear(int birthYear){
		this.birthYear = birthYear;
	}
	
	public int getDeathYear(){
		return deathYear;
	}
	
	public void setDeathYear(int deathYear){
		this.deathYear = deathYear;
	}
	
	@Override
	public int hashCode(){
		int hash = 17;
		hash = 23 * hash + (name == null ? 0 : name.hashCode());
		hash = 23 * hash + birthYear;
		hash = 23 * hash + deathYear;
		return hash;
	}
	
	@Override
	public boolean equals(Object obj){
		if(obj == null) return false;
		if(this == obj) return true;
		if(!(obj instanceof Author)) return false;
		
		Author arg = (Author) obj;
		return name.equals(arg.name) &&
				birthYear == arg.birthYear && 
				deathYear == arg.deathYear;
	}
}
